<template>
  <view class="carousel">
    <view class="bg"></view>
    <view class="swiper-content">
      <u-swiper
        :list="carouselList"
        :effect3d="true"
        border-radius="10"
        height="300"
        bg-color="transparent"
        @click="goDetail"
      ></u-swiper>
    </view>
  </view>
</template>

<script>
export default {
  props: ["carouselList"],
  data() {
    return {}
  },
  methods: {
    goDetail(current) {
      let res = this.carouselList.filter(function (v, i) {
        return current == i
      })
      let avatar = uni.getStorageSync("avatar")
      if (!avatar) {
        uni.navigateTo({
          url: "/pages/login/login",
        })
        return
      }
      uni.navigateTo({
        url: "/pages/detail/detail?id=" + res[0].article_id,
      })
    },
  },
}
</script>
<style lang="scss" scoped>
.carousel {
  .swiper-content {
    padding-top: 20upx;
  }
}
</style>
